Kinds of Errors
Every script error falls into one of the following categories:
- Operating System errors are errors that occur when AppleScript or an application requests services from the Operating System. They are rare, and, more importantly, there's usually nothing you can do about them in a script. A few, such as
"File <name> wasn
't found"
and"Application isn
't running"
, make sense for scripts to handle. These errors are listed in Appendix C, "Error Messages."- Apple event errors are Operating System errors that occur when the underlying message system for AppleScript--known as Apple events--fails. Many of these errors, such as
"No user interaction allowed"
, are
of interest to users. Also of interest to users are errors that have to do with reference forms, as well as errors like"No such object"
. These errors are listed in Appendix C, "Error Messages."- Apple Event Registry errors are errors returned by applications when handling standard AppleScript commands (commands that apply to all applications). Many of these, such as
"The specified object is a property, not an element"
, are of interest to users and should be handled. These errors are listed in Appendix C, "Error Messages."- AppleScript errors are errors that occur when AppleScript processes script statements. Nearly all of these are of interest to users. These errors are listed in Appendix C, "Error Messages."
- Application errors are any additional errors returned by applications. Applications can define any number of additional error messages for
the AppleScript commands they handle. These errors are listed in the documentation for applications that define them.- Script errors are error messages sent by a script using the Error command. Scripts that define additional errors will often include descriptions of the errors in their documentation.
- Note
- Many "errors" are the result of the normal operation of a command. For example, the Choose File command returns error -128 if the user presses the Cancel button in the resulting dialog box. Scripts must routinely handle such errors to ensure normal operation.
![]()